//
//  GuestCouponCommentListViewController.m
//  penzer
//
//  Created by 还带大道 on 2018/11/10.
//  Copyright © 2018年 caiyc. All rights reserved.
//

#import "GuestCouponCommentListViewController.h"
#import "GuestCouponCommentTableViewCell.h"
#import "CouponCommentListHV.h"
#import "GuestCouponCommentViewController.h"

@interface GuestCouponCommentListViewController ()<UITableViewDataSource,UITableViewDelegate>
@property (nonatomic,weak) UITableView *tableView;
@property (nonatomic,assign) NSInteger cureentIndex;
@end

@implementation GuestCouponCommentListViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.view.backgroundColor = [UIColor whiteColor];
    [self setNavigation:YES andTitle:@"评论" andNaviColor:[UIColor whiteColor] andTitleColor:nil];
    [self setupTableView];
    
}


- (void)setupTableView
{
    UITableView *tableView = [[UITableView alloc] init];
    self.tableView = tableView;
    tableView.delegate = self;
    tableView.dataSource = self;
    tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
    [self.view addSubview:tableView];
    [tableView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(kTopHeight);
        make.left.right.bottom.equalTo(self.view);
    }];
    
    CouponCommentListHV *headerV = [CouponCommentListHV shareView];
    headerV.height = 145;
    headerV.itemOnClickBlock = ^(NSInteger index) {
        self.cureentIndex = index;
//        [self.tableView reloadData];
    };
    self.tableView.tableHeaderView = headerV;
    
    [self.tableView registerNib:[UINib nibWithNibName:NSStringFromClass([GuestCouponCommentTableViewCell class]) bundle:nil]  forCellReuseIdentifier:NSStringFromClass([GuestCouponCommentTableViewCell class])];
}



- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return 3;
}


-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    return 200;
}


-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
   GuestCouponCommentTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:NSStringFromClass([GuestCouponCommentTableViewCell class])];
    return cell;
}


- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    GuestCouponCommentViewController *gue = [GuestCouponCommentViewController new];
    [self pushSecondVC:gue];
}


@end
